package com.base.cn.platform.os.service.manage.user.address;

import com.base.cn.platform.os.service.FeignAuthConfig;
import com.base.cn.platform.os.service.manage.BaseService;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 用户地址接口
 * @author ll
 * @create 2018-5-28-14:21
 */
@FeignClient(value = BaseService.appName,configuration = FeignAuthConfig.class)
public interface CusUserAddressService extends BaseService {

    /**
     * 修改设置默认地址
     * @param addressId 地址ID
     * @param isFirst 默认状态，1是，2不是
     * @return
     */
    @RequestMapping(contextPath + "/user/updateUserAddressIsFirst")
    Map<String,Object> updateUserAddressIsFirst(@RequestParam("addressId") BigDecimal addressId,
                                                @RequestParam("isFirst") Integer isFirst);


    /**
     * 保存修改用户
     * @param userAddress 用户地址
     * @return
     */
    @RequestMapping(contextPath + "/user/saveUpdateCusUserAddress")
    Map<String, Object> saveUpdateCusUserAddress(@RequestBody Map<String, Object> userAddress);

    /**
     * 搜索地址列表
     * @return
     */
    @RequestMapping(contextPath + "/user/queryUserAddressListPage")
    Map<String,Object> queryUserAddressListPage(@RequestParam(value = "currentPage", required = false, defaultValue = "1") Integer currentPage,
                                                @RequestBody Map<String, Object> userAddress,
                                                @RequestParam(value = "setUserAddress", required = false, defaultValue = "false") boolean setUserAddress);

    /**
     * 搜索地址列表
     * @return
     */
    @RequestMapping(contextPath + "/user/queryUserAddressList")
    List<Map<String,Object>> queryUserAddressList(@RequestBody Map<String, Object> userAddress,
                                                  @RequestParam(value = "setUserAddress", required = false, defaultValue = "false") boolean setUserAddress);

    /**
     * 用户Id搜索地址
     * @param userId 用户ID
     * @param setUserAddress 用户地址
     * @return
     */
    @RequestMapping(contextPath + "/user/queryUserAddressListByUserId")
    List<Map<String,Object>> queryUserAddressListByUserId(@RequestParam("userId") BigDecimal userId,
                                                          @RequestParam(value = "setUserAddress", required = false, defaultValue = "false") boolean setUserAddress);


    /**
     * 根据ID获取地址
     * @param addressId
     * @return
     */
    @RequestMapping(contextPath + "/user/queryUserAddressById")
    Map<String,Object> queryUserAddressById(@RequestParam("addressId") BigDecimal addressId,
                                            @RequestParam(value = "setUserAddress", required = false, defaultValue = "false") boolean setUserAddress);


    /**
     * 根据ID删除
     * @param addressId
     * @return
     */
    @RequestMapping(contextPath + "/user/deleteUserAddressById")
    Map<String,Object> deleteUserAddressById(@RequestParam("addressId") BigDecimal addressId);

}
